#!/usr/bin/env node

const http = require('http'),
      url  = require('url'),
      qs   = require('querystring'),
      log  = console.log;

http.createServer((req, res) => {
   log('HTTP request URL:', req.url);

   //get pathname and query string
   
   let addr = url.parse(req.url);
   log(addr.pathname);
   log(addr.query);

   log(addr.pathname.split('/'));
   log(qs.parse(addr.query));

}).listen(8080);
